<?php
/**
 * Created by .
 * User: 小涛
 * Date: 2018/3/7
 * Time: 15:44
 */

namespace app\admin\service;

use think\Cache;

/**
 * Class ShortCode
 * @package app\admin\service
 */
class ShortCode
{
    public static function ShortCode($phone){
        $str = rand(0, 9999);
        $max = strlen($str) - 1;
        $y = "";
        for ($i = $max; $i < 3; $i ++){
            $y = $y."0";
        }
        $Code = $y.$str;
        $str = hort_CodSe($Code,$phone);
        if($str == "短信发送成功") {
            Cache::set($phone, strtolower($Code), intval(10 * 60));
        }
        return $str;
    }
}